package ee.ut.maxorato_macobo.oop.mud.items;

import java.util.TreeMap;

public class ItemTemplatePool {
	private static TreeMap<String, ItemTemplate> tempList = new TreeMap<String, ItemTemplate>();
	
	public static boolean registerItemTemp(ItemTemplate template) {
		if(tempList.containsKey(template.getUniqueName())) return false;
		
		tempList.put(template.getUniqueName(), template);
		return true;
	}
	
	public static boolean unregisterItemTemp(ItemTemplate template) {
		if(!tempList.containsKey(template.getUniqueName())) return false;
		
		tempList.remove(template.getUniqueName());
		return true;
	}
	
	public static ItemTemplate findByUniqueName(String uniqueName) {
		return tempList.get(uniqueName);
	}
	
	public static TreeMap<String, ItemTemplate> getTemplateList() {
		return tempList;
	}
	
	private ItemTemplatePool() {
		
	}
}
